package com.example.demo.service.impl;

import com.example.demo.domain.User;
import com.example.demo.domain.Vo.StudentInforVo;
import com.example.demo.domain.Vo.UserListVo;
import com.example.demo.mapper.UserMapper;
import com.example.demo.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

/**
 * 服务层
 */
@Service
public class UserServiceImpl implements IUserService {

    @Autowired
    private UserMapper userMapper;

    /**
     * 查询用户
     * @param user
     * @return
     */
    @Override
    public List<UserListVo> selectUser(User user) {
        return userMapper.selectUser(user);
    }

    /**
     * 新增用户
     * @param user
     */
    @Override
    public void insertUser(User user) {
        userMapper.insertUser(user);
    }

    /**
     * 修改用户
     * @param user
     */
    @Override
    public void updateUserById(User user) {
        userMapper.updateUserById(user);
    }

    /**
     * 删除用户
     * @param id
     */
    @Override
    public void delUserById(long id) {
        userMapper.delUserById(id);
    }

    @Override
    public User selectOneUser(User user) {
        return userMapper.selectOneUser(user);
    }

    @Override
    public List<StudentInforVo> selectStudentInfor() {
        return userMapper.selectStudentInfor();
    }

    /**
     * 查询用户信息
     * @param id
     */
    @Override
    public List<User> selectByUserId(Long id){ return userMapper.selectByUserId(id);}
}
